<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>闪电批量发货 -- 大眼窝进销存系统</title>
<load href='__PUBLIC__/bootstrap/css/bootstrap.min.css' />
<load href='__PUBLIC__/Css/style.css' />
<style type="text/css">
	.order_info{height:352px;margin-left: 5px;}
	.order_info .row {min-height: 19px;line-height: 19px;}
</style>
<?php 
	function merge_order_detail(&$order_detail,$sale_detail){
        foreach ($sale_detail as $key => $value) {
            __merge_order_detail($order_detail,$sale_detail,$value,$key);
        }
        return $order_detail;
    }

    function __merge_order_detail(&$order_detail,$sale_detail,$value,$key){
       
            if($key == 0)
                $order_detail[0] = $value;
            else{
                if( !empty($value['out_number'])  
                	&& $value['out_number'] == $sale_detail[$key-1]['out_number']
                   && $value['options'] == $sale_detail[$key-1]['options'] ){
                    if(is_array($order_detail[$key-1])){
                       $order_detail[$key-1]['number'] += $value['number'];
                        $order_detail[$key-1]['total'] += $value['total']; 
                    }else{
                        __merge_order_detail($order_detail,$sale_detail,$value,$key-1);
                    }
                    
                }else
                   $order_detail[$key] = $value;
            }
        return $order_detail;
    }
 ?>
</head>
<body>
<div id="main" class="main" >
<div class="row" style="margin-left:10px;">
	<h2 class="heading">批量闪电发货</h2>
		<div class="span21">
			默认汇通快运，起始单号<input type="text" name="start_no" value="{$start_no}">
			终止单号<input type="text" name="end_no" value="{$end_no}">
		</div>
</div>
<div class="row  heading" style="margin-left:10px;">
				<div class="span1">序号</div>
				<div class="span3" >订单号</div>
				<div class="span2">收货人</div>
				<div class="span4">地址</div>
				<div class="span2">快递</div>
				<div class="span3">单号</div>
				
			</div>
<form action="__URL__/mass_update" method="post" >
	<volist name="orders" id="vo">
			
			<div class="row heading" style="margin-left:10px;">
				<div class="span1">{$i}</div>
				<div class="span3" >{$vo.sale_no} <input type="hidden" name="id[]" value="{$vo.id}">
					<input type="hidden" name="shipping_time[]" value="{:time()}"> 
					<input type="hidden" name="order_status[]" value="3"> <!--已发货-->
				</div>
				<div class="span2">{$vo.shipping_name}</div>
				<div class="span4">{$vo.address}</div>
				<!--默认汇通快运 -->
				<div class="span2"	>
					<empty name="vo.logicompany_id"> 
						{:modList('Logicompany',18,'span2','logicompany_id[]','sort desc' )}
						<else/>
						{:modList('Logicompany',$vo['logicompany_id'],'span2','logicompany_id[]','sort desc' )}
					 </empty>
					</div>
				<div class="span3"> <input type="text" name="logino[]" value="{$start_no+$i-1}"> </div>
			</div>
	</volist>
	<div class="row">
        <div class="span10"> 
        	<a href="__URL__" class="btn btn-primary offset2">返回列表</a>
        	<input type="submit" value="批量发货" class="btn btn-primary offset5">
        	
        </div>
	</div>
</form>

</div>
</body>
</html>
